//
//  BBMyApproveDetailController.m
//  2222
//
//  Created by BearBaby on 16/3/25.
//  Copyright © 2016年 BearBaby. All rights reserved.
//

#import "BBMyApproveDetailController.h"
#import "BBMyApproveDetailCell.h"
#import "BBSixHeader.h"
@interface BBMyApproveDetailController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView* tableView;
@property(nonatomic,strong)UIView* view1;
@property(nonatomic,strong)UIButton* rejectBtn;       //驳回按钮
@property(nonatomic,strong)UIButton* agreeBtn;        //同意按钮
@end

@implementation BBMyApproveDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"审批流程";
    self.view.backgroundColor = [UIColor whiteColor];
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, WINSIZEHEIGHT-60) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@""] style:UIBarButtonItemStylePlain target:self action:@selector(apply:)];
    
    self.view1 = [[UIView alloc]initWithFrame:CGRectMake(0, WINSIZEHEIGHT - 60, WINSIZEWIDTH, 60)];
    
    [self.view addSubview:self.view1];
    //驳回按钮
    self.rejectBtn = [[UIButton alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/7, 10, WINSIZEWIDTH/7*2, 40)];
    self.rejectBtn.layer.cornerRadius = 5;
    self.rejectBtn.layer.masksToBounds = YES;
    self.rejectBtn.titleLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
    [self.rejectBtn setTitle:@"驳回" forState:UIControlStateNormal];
    [self.rejectBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.rejectBtn setBackgroundColor:[UIColor colorWithRed:97/255.0 green:99/255.0 blue:110/255.0 alpha:1]];
    [self.view1 addSubview:self.rejectBtn];
    
    //同意按钮
    self.agreeBtn = [[UIButton alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/7*4, 10, WINSIZEWIDTH/7*2, 40)];
    self.agreeBtn.layer.cornerRadius = 5;
    self.agreeBtn.layer.masksToBounds = YES;
    self.agreeBtn.titleLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
    [self.agreeBtn setTitle:@"同意" forState:UIControlStateNormal];
    [self.agreeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.agreeBtn setBackgroundColor:[UIColor colorWithRed:230/255.0 green:116/255.0 blue:46/255.0 alpha:1]];
    [self.view1 addSubview:self.agreeBtn];
    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;

}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BBMyApproveDetailCell* cell = nil;
    if (indexPath.section==0) {
        static NSString* identifire = @"Cell";
        cell = [self.tableView dequeueReusableCellWithIdentifier:identifire];
        if (!cell) {
            cell = [[BBMyApproveDetailCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifire];
            cell.delegate = self;
        }
    }else{
        UITableViewCell* cell1 = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
        cell1.textLabel.text = @"审批流程详情";
        cell1.textLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
        cell1.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell1;
    }
    
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.0000001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 15;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        CGFloat cellHeight = 0.0f;
        BBMyApproveDetailCell* cell = (BBMyApproveDetailCell*)[self tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath];
        cellHeight = cell.finalH;
        return cellHeight;
    }else
        return 44;
    
    
    
}


@end
